#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;

class Solution {
public:
    int singleNumber(vector<int>& nums) {
        map<int,int> M;
        for(int i = 0;i<nums.size();++i){
            ++M[nums[i]];
        }
        for(auto i = M.begin();i!=M.end();++i){
            if(i->second==1){
                return i->first;
            }
        }
        return 0;
    }
};